/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ps.server.classes;

/**
 *
 * @author Ricardo
 */
public class categories {

    private String id;
    private String id_parent;
    private String active;
    private String[][] name;
    private String[][] link_rewrite;
    private String[][] meta_title;
    private String[][] meta_description;
    private String[][] meta_keywords;
    private String[][] description;
    private String[] categories;
    private String[] products;

    private int column=11;
    
    public String getActive() {
        return active;
    }

    public void setActive(String active) {
        this.active = active;
    }

    public String[] getCategories() {
        return categories;
    }

    public void setCategories(String[] categories) {
        this.categories = categories;
    }

    public String[][] getDescription() {
        return description;
    }

    public void setDescription(String[][] description) {
        this.description = description;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getId_parent() {
        return id_parent;
    }

    public void setId_parent(String id_parent) {
        this.id_parent = id_parent;
    }

    public String[][] getLink_rewrite() {
        return link_rewrite;
    }

    public void setLink_rewrite(String[][] link_rewrite) {
        this.link_rewrite = link_rewrite;
    }

    public String[][] getMeta_description() {
        return meta_description;
    }

    public void setMeta_description(String[][] meta_description) {
        this.meta_description = meta_description;
    }

    public String[][] getMeta_keywords() {
        return meta_keywords;
    }

    public void setMeta_keywords(String[][] meta_keywords) {
        this.meta_keywords = meta_keywords;
    }

    public String[][] getMeta_title() {
        return meta_title;
    }

    public void setMeta_title(String[][] meta_title) {
        this.meta_title = meta_title;
    }

    public String[][] getName() {
        return name;
    }

    public void setName(String[][] name) {
        this.name = name;
    }

    public String[] getProducts() {
        return products;
    }

    public void setProducts(String[] products) {
        this.products = products;
    }

    public String toXML() {
        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
        xml += "<prestashop xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
        xml += "<category>\n";
        xml += "<id></id>\n";
        xml += "<id_parent></id_parent>\n";
        xml += "<active></active>\n";
        xml += "<name>\n";
        for (int x = 0; name.length > x; x++) {
            xml += "<language id=\"" + name[x][0] + " \">" + name[x][1] + "</language>\n";
        }
        //<language id="3"></language>
        //<language id="5"></language>
        xml += "</name>\n";
        xml += "<link_rewrite>\n";
        for (int x = 0; link_rewrite.length > x; x++) {
            xml += "<language id=\"" + link_rewrite[x][0] + " \">" + link_rewrite[x][1] + "</language>\n";
        }
        //<language id="3"></language>
        //<language id="5"></language>
        xml += "</link_rewrite>\n";
        xml += "<meta_title>\n";
        for (int x = 0; meta_title.length > x; x++) {
            xml += "<language id=\"" + meta_title[x][0] + " \">" + meta_title[x][1] + "</language>\n";
        }
        //<language id="3"></language>
        //<language id="5"></language>
        xml += "</meta_title>\n";
        xml += "<meta_description>\n";
        for (int x = 0; meta_description.length > x; x++) {
            xml += "<language id=\"" + meta_description[x][0] + " \">" + meta_description[x][1] + "</language>\n";
        }
        //<language id="3"></language>
        //<language id="5"></language>
        xml += "</meta_description>\n";
        xml += "<meta_keywords>\n";
        for (int x = 0; meta_keywords.length > x; x++) {
            xml += "<language id=\"" + meta_keywords[x][0] + " \">" + meta_keywords[x][1] + "</language>\n";
        }
        //<language id="3"></language>
        //<language id="5"></language>
        xml += "</meta_keywords>\n";
        xml += "<description>\n";
        for (int x = 0; description.length > x; x++) {
            xml += "<language id=\"" + description[x][0] + " \">" + description[x][1] + "</language>\n";
        }
        //<language id="3"></language>
        //<language id="5"></language>
        xml += "</description>\n";
        xml += "<associations>\n";
        xml += "<categories>\n";
        for (int x = 0; categories.length > x; x++) {
            xml += "<address>\n";
            xml += "<id>" + this.categories[x] + "</id>\n";
            xml += "</address>\n";
        }
        //xml+="<category>\n";
        //xml+="<id></id>\n";
        //xml+="</category>\n";

        xml += "</categories>\n";
        xml += "<products>\n";
        for (int x = 0; products.length > x; x++) {
            xml += "<product>\n";
            xml += "<id>" + this.products[x] + "</id>\n";
            xml += "</product>\n";
        }

        //xml+="<product>\n";
        //xml+="<id></id>\n";
        //xml+="</product>\n";
        xml += "</products>\n";
        xml += "</associations>\n";
        xml += "</category>\n";
        xml += "</prestashop>";

        return xml;
    }
    
    
        public int getColumn() {
        return this.column;
    }

    public String[] GetMetaData() {
        return new String[]{"id", "id_parent", "active", "name", "link_rewrite", "meta_title", "meta_description", "meta_keywords", "description","categories","products"};
    }
}
